Developer Home Contents Search Feedback Support Intel(r)

Connected CDs

Previous Section | Next Section
Table of Contents

 

Appendix A. Programming Examples

The following examples are provided for reference only and are not guaranteed to be complete working examples.

A.1 Registering ActiveX Controls

A.1.1 Using Visual Basic 5.0 CCE Application Setup Wizard

Before your control can be used on the Internet, it needs to be able to register itself on the client's computer. If you've used the Visual Basic 5.0 Control Creation Edition* (CCE) you can easily create an automated setup package for registering your control:

  1. Launch the Application Setup Wizard from the Visual Basic 5.0 CCE program group.
  2. ClickBrowse to locate your control project.
  3. Click Create Internet Download Setup.
  4. Step through the dialog boxes. When the setup program is complete, the wizard will have generated two sets of files: distribution files and support files. The distribution files include a .cab file that contains a compressed version of your control and a sample HTML file that illustrates how to insert the ActiveX control into an HTML page. The support files are created in case you may need to make changes later on.

For more information on preparing Visual Basic controls for the Internet, refer to Microsoft's Website.

A.1.2 Create Your Own Cab

Cabinet files, or cab for short, is a file archive used to simplify the compression and installation of multiple ActiveX controls. It is possible to support multiple platforms with the installation method. Adding an INF file to the cab archive tells the system how to install the control.

Creating a cab file using DIANTZ.EXE

  1. create necessary INF file ;Sample INF file
    [Add.Code]
    ExampleControl.OCX = Example.Control.OCX

    [ExampleControl.OCX]
    File=http://www.example.com/control/ExampleControl.OCX
    CLSID = {Appropriate CLSID}
    FileVersion=1.0.0.0

    For multi-platform support refer to Microsoft's cabinet development kit.

  2. Build Diamond directive file (DDF). .Option Explicit
    .Set CabinetNameTemplate = Example.CAB
    .Set Cabinet = on
    .Set Compress = on

    ExampleControl.OCX

  3. run DIAMOND.EXE from the Cabinet SDK. DIAMOND /f Example.DDF
    /f - specifies the a file directive is being used

  4. Insert cab into web page <OBJECT>
    CLASSID="clsid:{Valid CLSID}"
    CODEBASE="controls/ExampleControl.cab#Version=1,0,0,0">
    </OBJECT>

A.2 Link Resolution Control

The Link Resolution control is a customized OLE control that locates locally-available resources. If the resources are not located locally, then the according http address is constructed from the file name, and the URL is pointed there.

The control was written with MSVC++ 4.1. It can be embedded within a web page, a Visual Basic application, or used in a MSVC app. Below is a list of the properties and methods needed to implement the Link Resolution control.

Properties

Type

Purpose

BackColor

RGB Value

Determines the background color for the control

CDROMLabel

LPCSTR

Verify CDROMLabel is the label of the CD in the drive

CDROMLinkColor

RGB Value

Determines the color of the CD linked resources

DisplayCDError

Boolean

Determines if error messages are displayed or not.

DisplayTest

Boolean

Controls whether the text property is displayed

LinkName

LPCSTR

Name of URL to resolve

LocalLinkColor

RGB Value

Determines the color of the locally linked resources

NameCacheFile

LPCSTR

Specifies location and name of the cache.tlb file

PushDataDir

LPCSTR

Specify location where downloaded data is kept

Text

LPCSTR

Text string displayed if DisplayText is True

UserNameCache

Boolean

Determines whether or not the default cache filename is used or if a user specified name is used

Methods

Function

Resolve

Resolve the location of the resource. Determine if content is available on the Internet or on the CDROM

AboutBox

Information about the Link Resolution Control

Example Use In HTML

<OBJECT ID="LnkRslv1" WIDTH=93 HEIGHT=27 CLASSID="CLSID:4E401503-7DCB-11D0-A060-00AA00C0F5D6"
CODEBASE="/controls/codebase/">

<PARAM NAME="_Version" VALUE="65536">
<PARAM NAME="_ExtentX" VALUE="2455">
<PARAM NAME="_ExtentY" VALUE="709">
<PARAM NAME="_StockProps" VALUE="21">
<PARAM NAME="DisplayText" VALUE="1">
<PARAM NAME="CDROMLabel" VALUE="MyCDROMLabel">
<PARAM NAME="LinkName" VALUE="http://www.intel.com/video.avi">
<PARAM NAME="Text" VALUE="Link Resolution">
</OBJECT>

A.3 Password Required Video Playback Control

This custom control may be embedded within a Visual Basic application, a Visual C++ application, or in a web browser. The control takes advantage of the Indeo video key frame encryption codec. This enables the Internet server to control when video may be viewed by forcing the user be logged on to the website to get the video access key.

Properties

Type

Purpose

AccessKey

Unsigned Long

The key needed to decrypt indeo video 4.1 that was compressed with it.

AutoStart

Boolean

Activate the video as soon as ActiveMovie loads the file.

CDROMLabel

LPCSTR

Check for the volume label of the CD that is current in the CDROM drive.

DisplayImage

Boolean

Display the background image if video can not be rendered.

MovieName

LPCSTR

The movie file name to be played.

UseLinkResolver

Boolean

Use link resolution to resolve the location of resources.

Methods

Function

AboutBox

Displays version and copyright information about the control

Run

Play the video

Stop

Stop the playback of the video

Pause

Pause the playback of the video, and keep current position.

HTML VideoPlay example

<OBJECT ID="VideoPlay1" WIDTH=320 HEIGHT=240 CLASSID="CLSID:7F14A103-83FC-11D0-9FB2-00A0C9008A48"
CODEBASE="/controls/Jamplay/">
<PARAM NAME="MovieName" VALUE="d:\avi\1234key.avi">
<PARAM NAME="AccessKey" VALUE="1234">
<PARAM NAME="CDROMLabel" VALUE="MyCDROM">
</OBJECT>

A. 4 Forcing A Connection Using WININET

The following is an example of using WININET to force a connection to the Internet.

The code sample below:

  1. Establishes a connect if none are available, using default ISP connection. This must be enabled in the Internet section of the Control Panel.
  2. Connects to the specified server on the Web with the given user name and password.
  3. Retrieves the file information of ./.
  4. Processes the information. In this case, prints it to the debug screen of MSVC.

No error checking is included for brevity.

It is important to note that the wininet.h and the wininet.lib are required.

//Internet handles 
HINTERNET hOpen = NULL;
HINTERNET hConnect = NULL;
HINTERNET hRequest = NULL;
DWORD dwSize=0, dwCode=0, dwContext=0;
CHAR *lpBuffer, szData[51];
BOOL bRetVal=FALSE;
//Attempt an Internet connection. This will invoke the default dial up
//adapter if the option is enabled in control panel->Internet->Connect. 
//If the option is not set, the attempt fails. 
InternetAttemptConnect(dwCode);
//Initialize an applications use of wininet functions
hOpen = InternetOpen("My Web Agent",    //Name of Agent Making Calls
      INTERNET_OPEN_TYPE_DIRECT,        //Access Type Resolve host name locally
      NULL, 0,0);
//Connect to URL with user name and password. 
//This allows for restricted server access. 
     hConnect = InternetConnect(hOpen,      //Handle
     "www.myserver.com",                    //Server
     INTERNET_INVALID_PORT_NUMBER,          //Port
     "UserName",                            //UserName
     "UserPassword",                        //UserPasswd
     INTERNET_SERVICE_HTTP,                 //Service
     0,                                     //Flags
     dwContext);                            //Context
//Open http request handle
//Opens a handle to the file login.htm
hRequest = HttpOpenRequest(hConnect,        //Session
     "GET",              //Verb {NULL="GET"}
     "login.htm",        //Target Object
     HTTP_VERSION,       //Address of Version Str 
     "",                 //URL of where last was
     NULL,//Accept Types
   INTERNET_FLAG_RELOAD |  //Access Types       
   INTERNET_FLAG_EXISTING_CONNECT,    
   dwContext);          //Context
//Send request to server
bRetVal = HttpSendRequest(hRequest, NULL, 0, NULL, 0);
//set DWORD size
dwSize = sizeof(DWORD);
HttpQueryInfo (hRequest, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &dwCode, &dwSize, NULL);
HttpQueryInfo(hRequest, HTTP_QUERY_RAW_HEADERS_CRLF, (LPVOID) NULL, &dwSize, NULL);
//allocate buffer size based on page size
lpBuffer = new char [dwSize+1];
HttpQueryInfo(hRequest, HTTP_QUERY_RAW_HEADERS_CRLF, (LPVOID) lpBuffer,
                  &dwSize, NULL);
    
//Terminate the buffer
*(lpBuffer + dwSize) = '\0';
    
//DO SOMETHING MEANINGFUL!!
    do
    {    //quit if read error
        if(!InternetReadFile(hRequest, (LPVOID)szData, 50, &dwSize))
        {
            //fail to read
        }
        //if no more data to print break
        if(!dwSize)
            break;
        else
        {
            //output the buffer string
            szData [dwSize] = '\0';
            OutputDebugString(szData);
        }
    }while(TRUE);
    cout << endl;
    
    //Close Internet handles
    InternetCloseHandle(hRequest);
    InternetCloseHandle(hConnect);
    InternetCloseHandle(hOpen);
    
    //free buffer space
    free(lpBuffer);

Appendix B. "Audio" Connected CDs

B.1 CD EXTRA

What Is CD EXTRA?

CD EXTRA offers the consumer a full audio album that also has an interactive experience when played on a computer CD-ROM drive.

Many traditional music CDs have extra room available at the end of the disc. CD EXTRA takes advantage of this extra space by adding a multimedia, computer portion or second session. CD EXTRA is a multi-session disc with the first session containing the audio portion and the second session containing the multimedia portion. CD EXTRA will play on any audio CD player just like a traditional audio CD. CD EXTRA multimedia data will play on CD-ROM drives with multi-session compatible firmware and software. (CD EXTRA is not compatible with some older CD-ROM Drives.) Many of Sony's new audio releases will feature a free multimedia portion. The user can access interactive lyrics and animated stories, music videos, exclusive video interviews, and much more.

For more information see http://www.music.sony.com/Music/CDEXTRA/.

Appendix C. The InfiniteCD

The InfiniteCD is a direct result of Intel's hybrid application initiative and its industry work with several key software developers and content providers. The InfiniteCD consists of several components: a media-enabled Connected PC with Pentium® processor with MMX™ technology, high-capacity local storage (such as CD-ROM / DVD and HD), connection to the Internet through modem, for instance, and a specially prepared CD / DVD-ROM.

The InfiniteCD is intended to bring very rich media - typically the type used in the entertainment industry - to the PC desktop using hybrid methodology. The goal is to provide a rich media experience - such as the consumer is used to having with television, motion pictures and music - and deliver a framework which would allow the content provider to fully immerse the user in their trademark environment and interface.

Physically, the InfiniteCD is a local storage medium (CD or DVD-ROM) containing rich media, executable code and information links which allow it to interact with a connection to a remote Internet site and dynamically update and extend information and content.

InfiniteCD Block Diagram

The architecture of the InfiniteCD encompasses both "pull" technologies which reach out to grab information when it is needed (exemplified by capabilities such as Macromedia's Shockwave) and "push" technologies which have the ability to drive content from the server down to the desktop's hard drive without the user's application intervening (Marimba's Castanet, for instance). In this respect, the InfiniteCD capitalizes on the concept of intelligent pre-caching which attempts to predict what the user will need well in advance of its use. Determining this, the current revision of information on the desktop is checked and an updated version is sent down from the server and linked to the application. Contrary to "pull", which has traditionally implied loading prior to execution or transfer on demand, intelligent push caching would utilize available communications bandwidth whenever it was not being actively used by the consumer. Or another way of looking at it is that all available bandwidth is being used constantly in the background and not simply when it is needed by the application. Consequently, marrying pull and push technologies provides a highly efficient data management framework for the InfiniteCD application.

Appendix D. References

Intel Developer Relations Group

URL: http://www.intel.com/drg

 

Back to Cookbooks | Back to Top

Previous Section | Next Section
Table of Contents

 

* Other brands and names are the property of their respective owners


* Legal Information © 1998 Intel Corporation